﻿using NHibernate;
namespace OpenWaves.ActivityFeed.NHibernate
{
    public static class NHibernateActivityFeedSessionFactory
    {
        private static volatile ISessionFactory _factory;
        private static readonly object LockObject = new object();

        public static ISessionFactory Current
        {
            get
            {
                if (_factory == null)
                {
                    lock (LockObject)
                    {
                        if (_factory == null)
                        {
                            _factory = ServiceLocator.Resolve<INHibernateSessionFactory>().CreateSessionFactory();
                        }
                    }
                }
                return _factory;
            }
        }
    }
}